﻿using System.Data;
using DataAccess;
using Entity;

namespace Business
{
    public class CategoryBus
    {
        private CategoryDao _categoryDao;
        public DataSet SelectAllCategory()
        {
            _categoryDao = new CategoryDao();
            return _categoryDao.SelectAllCategory();
        }
        public DataSet GetCategoryById(int id)
        {
            _categoryDao = new CategoryDao();
            return _categoryDao.SelectCategoryById(id);
        }
        public bool AddCategory(Category category)
        {
            _categoryDao = new CategoryDao();
            int result = _categoryDao.AddCategory(category);
            return (result != 0);
        }
        public bool UpdateCategory(Category category)
        {
            _categoryDao = new CategoryDao();
            int result = _categoryDao.UpdateCategory(category);
            return (result != 0);
        }
        public bool DeleteCategory(int id)
        {
            _categoryDao = new CategoryDao();
            int result = _categoryDao.DeleteCategory(id);
            return (result != 0);
        }
    }
}
